package com.example.litehdfs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.litehdfs.config.ResponseMsg;
import com.example.litehdfs.model.dto.AdminLoginInfo;
import com.example.litehdfs.model.req.AdminLoginReq;
import com.example.litehdfs.service.AdminService;

import lombok.extern.slf4j.Slf4j;

/**
 * 后台管理相关接口，拦截
 */
@RestController
@RequestMapping("/admin")
@Slf4j
public class AdminController {

	@Autowired
    private AdminService adminService;
	
	//管理员登录
    @PostMapping("/login")
    public ResponseMsg<AdminLoginInfo> adminLogin(@RequestBody AdminLoginReq req) {
        return ResponseMsg.ofSuccess(adminService.adminLogin(req));
    }

    //查询管理员信息
    @PostMapping("/getAdminInfo")
    public ResponseMsg<AdminLoginInfo> getAdminInfo() {
        return ResponseMsg.ofSuccess(adminService.getAdminInfo());
    }
    
 
	
}
